package com.example.demo;

import com.example.demo.rocketmq.ReceiveService;
import com.example.demo.rocketmq.SenderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.messaging.Sink;
import org.springframework.cloud.stream.messaging.Source;

@EnableBinding(value = {Source.class, Sink.class}) //使得Source生效
@SpringBootApplication
public class GetechRocketmqApplication implements CommandLineRunner {

    @Autowired
    private SenderService senderService;
    @Autowired
    private ReceiveService receiveService;
    public static void main(String[] args) {
        SpringApplication.run(GetechRocketmqApplication.class, args);
    }
    //在main中调用发送信息方法
    @Override
    public void run(String... args) throws Exception {
        senderService.send("hello rocketmq");
    }

}
